package com.itheima.service.impl;

import com.itheima.mapper.AreaMapper;
import com.itheima.pojo.Area;
import com.itheima.service.AreaService;
import com.itheima.util.SqlSessionFactoryUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.util.List;
import java.util.Map;

public class AreaServiceImpl implements AreaService {

@Override
    public List<Area> selectById(@Param("id")int pid){

        SqlSessionFactory sqlSessionFactory = SqlSessionFactoryUtils.getSqlSessionFactory();
        SqlSession sqlSession = sqlSessionFactory.openSession();

        AreaMapper mapper = sqlSession.getMapper(AreaMapper.class);

        List<Area> areas = mapper.selectById(pid);

        sqlSession.close();
        return areas;

    }
}
